package com.javaEE.tes.services;

import com.javaEE.tes.dao.StudentRepository;
import com.javaEE.tes.dao.dto.StudentClass1;
import com.javaEE.tes.entities.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {
    @Autowired
    StudentRepository studentRepository;
    public Student save(Student student){
        return studentRepository.save(student);

    }
    public List<Student> getAll(){return studentRepository.findAll();}

    public List<StudentClass1> studentClass1(){return studentRepository.studentClass1();}

//    public Student findByStudentId(long theId) {
//        return studentRepository.findByStudentId(theId);
//    }

    public Student findByUserAccount_UserId(Long userId){
        return studentRepository.findByUserAccount_UserId(userId);
    }
//    public void delete(Student theStudent) {
//       studentRepository.delete(theStudent);
//    }

}
